<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<script type="text/javascript" src="../../ajax.js"></script>
<?php 

//session_start();		//启用session支持
//if(isset($_SESSION['unc'])){		//获取登录的版主名称

$tur=0;
$imgname=$_FILES["file"]["name"];
$filetype = pathinfo($imgname, PATHINFO_EXTENSION);
if (($filetype == "gif")
		|| ($filetype == "GIF")
		|| ($filetype == "PNG")
		|| ($filetype == "png")
		|| ($filetype == "jpg")
		|| ($filetype == "JPG")
		|| ($filetype == "jpeg")
		|| ($filetype == "JPEG")) {
			if($_FILES["file"]["size"] < 200000){
				
		
				if ($_FILES["file"]["error"] > 0) {
					echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
				} else {
					
					$tur=1;
				}
			}else
			{
				echo "<script>alert('图片不能大于200KB'); history.back();</script>";
			}

}
else
{
	echo "<script>alert('查看你的图片格式是否正确'); history.back();</script>";
}
if ($tur==1) {
	$string = 'abcdefghijklmnopgrstuvwxyz0123456789';
	$rand = '';
	$rand .= substr($string,mt_rand(0,strlen($string)-1),4);
	$t=date("ymdHis").$rand;
	$filename=$t.$rand.".".$filetype;
	$testdir1=date("y")."/".date("m")."/".date("d");
	//$testdir="../../uploade/".date("y")."/".date("m")."/".date("d");
	//mkdirs($testdir);
	$testdir="../../uploade";
					move_uploaded_file($_FILES["file"]["tmp_name"],$testdir."/".$filename);
					$filename=$filename;
				
				
				
				//echo "<script>alert('信息修改成功');history.back();</script>";
			
			
	}


			
//	}else{
//		echo "<script>alert('请先登录'); window.location.href='make.php?mod=login';</script>";
//	}

?>

<script>
parent.document.getElementById('imgurl').value="<?=$filename;?>";
parent.document.getElementById('up_img').innerHTML='图片更新成功！';
</script>	